package com.pattern.create.factory.sf;

/**
 * static factory
 */
public class ChartFactory {

    public static Chart getChart(String type) {
        Chart chart = null;
        if ("histogram".equalsIgnoreCase(type)) {
            chart = new HistogramChart();
            System.out.println("init histogram");
        } else if ("pie".equalsIgnoreCase(type)) {
            chart = new PieChart();
            System.out.println("init pieChart");
        } else if ("line".equalsIgnoreCase(type)) {
            chart = new LineChart();
            System.out.println("init lineChart");
        }
        return chart;
    }
}
